var Color;
(function (Color) {
    Color[Color["Red"] = 0] = "Red";
    Color[Color["Green"] = 1] = "Green";
    Color[Color["Blue"] = 2] = "Blue";
})(Color || (Color = {}));
;
var c = Color.Red;
console.log(c);
var Name;
(function (Name) {
    Name[Name["zheng"] = 0] = "zheng";
    Name[Name["zhang"] = 6] = "zhang";
    Name[Name["zhou"] = 7] = "zhou";
})(Name || (Name = {}));
console.log(Name);
// any类型
function fun(obj) {
    return obj;
}
console.log(fun("132"));
// 断言
var someValue = "this is a string";
// 尖括号型
var strLength = someValue.length;
// as类型
var strLength1 = someValue.length;
console.log(strLength, strLength1);
// 数组去重 函数数据类型约束
var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 5, 4, 6, 1, 2, 1, 2, 3, 1, 4, 2];
var findArr = function (arr) {
    var newArr = [];
    arr.forEach(function (item) {
        if (newArr.indexOf(item) === -1) {
            newArr.push(item);
        }
    });
    return newArr;
};
console.log(findArr(arr));
// 定义一个数值和字符串的联合类型
var num = [2, "222"];
// 定义一个类型断言
var Assert = "我是郑星辉";
var isAssert = Assert.length;
// 定义一个vido实现函数的无返回值
function Viods() {
    console.log("woshivoid");
}
// 定义一个never的函数
function error(message) {
    throw new Error(message);
}
function fail() {
    return error("Something failed");
}
